﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Resources;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.IO;

namespace MuzičkiFeršterker
{
    [Serializable]
    [XmlRoot("Translation")]
    public class TransVar
    {
        public string Language;
        //ResourceManager resMgr = new ResourceManager();
        //Spremenljivke za prevode play-pause shem
        public string tPLAY;
        public string tPAUSE;
        public string tSTOP;
        public string tNEXT;
        public string tPREV;

        //SPremenljivke za delo z zavihki
        public string tNEWTAB;
        public string tREMTAB;
        public string tRENAMETAB;
        public string tNEWTABmenu;
        public string tCLOSETABmenu;
        public string tRENAMETABmenu;
        public string tINSERTNEWSTRING;

        //Spremnljivke za delo s pesmimi
        public string tADDSONG;
        public string tREMSONG;
        public string tCLRLIST;

        //Spremenljivke raznih headerjev
        public string tPLAYEDTOOLTIP;
        public string tREMAININGTOOLTIP;

        public string tSHUFFLEONTOOLTIP;
        public string tSHUFFLEOFFTOOLTIP;

        public string tBALANCE;
        public string tVOLUME;

        public string tGRADIENTCHECK;
        public string tBACKGROUNDCOLOR1LABEL;
        public string tBACKGROUNDCOLOR2LABEL;
        public string tSELECTCOLORBUTTON;
        public string tGROUPBOX;
        public string tTABBGCOLORLABEL;
        public string tSETTINGS;
        public string tNEWTABheader;
        //Languages predel
        public string tGROUPBOX2;
        public string tLABELLANGUAGES;
        public string tBUTTONLANGUAGES;

        public TransVar() // default = english
        {
            Language = "English";
            tPLAY = "Play";
            tPAUSE = "Pause";
            tSTOP = "Stop";
            tNEXT = "Next";
            tPREV = "Previous";
            tNEWTAB = "Create a new tab";
            tREMTAB = "Remove this tab";
            tRENAMETAB = "Rename this tab";
            tADDSONG = "Add one or multiple songs to playlist";
            tREMSONG = "Remove a song from playlist";
            tCLRLIST = "Clear the selected playlist";
            tNEWTABmenu = "New tab";
            tCLOSETABmenu = "Close tab";
            tRENAMETABmenu = "Rename tab";
            tINSERTNEWSTRING = "Insert the new string:";
            tREMAININGTOOLTIP = "Remaining time";
            tPLAYEDTOOLTIP = "Elapsed time";
            tSHUFFLEOFFTOOLTIP = "Turn shuffle on";
            tSHUFFLEONTOOLTIP = "Turn shuffle off";
            tBALANCE = "Balance:";
            tVOLUME = "Volume:";
            tGRADIENTCHECK = "Solid color";
            tBACKGROUNDCOLOR1LABEL = "Background color:";
            tBACKGROUNDCOLOR2LABEL = "Background colo 2:";
            tSELECTCOLORBUTTON = "Select color";
            tGROUPBOX = "Background colors";
            tTABBGCOLORLABEL = "Playlist background color:";
            tSETTINGS = "Settings";
            tNEWTABheader="New Tab ";
            tGROUPBOX2 = "Languages:";
            tLABELLANGUAGES = "Selected language: ";
            tBUTTONLANGUAGES = "Select language file";
        }
        public TransVar(String path)
        {
            if (File.Exists(@path))
            {
                TransVar temp;
                try
                {
                    temp = XmlSerializator.Load<TransVar>(@path);
                    Language = temp.Language;
                    tPLAY = temp.tPLAY;
                    tPAUSE = temp.tPAUSE;
                    tSTOP = temp.tSTOP;
                    tNEXT = temp.tNEXT;
                    tPREV = temp.tPREV;
                    tNEWTAB = temp.tNEWTAB;
                    tREMTAB = temp.tREMTAB;
                    tRENAMETAB = temp.tRENAMETAB;
                    tADDSONG = temp.tADDSONG;
                    tREMSONG = temp.tREMSONG;
                    tCLRLIST = temp.tCLRLIST;
                    tNEWTABmenu = temp.tNEWTABmenu;
                    tCLOSETABmenu = temp.tCLOSETABmenu;
                    tRENAMETABmenu = temp.tRENAMETABmenu;
                    tINSERTNEWSTRING = temp.tINSERTNEWSTRING;
                    tREMAININGTOOLTIP = temp.tREMAININGTOOLTIP;
                    tPLAYEDTOOLTIP = temp.tPLAYEDTOOLTIP;
                    tSHUFFLEOFFTOOLTIP = temp.tSHUFFLEOFFTOOLTIP;
                    tSHUFFLEONTOOLTIP = temp.tSHUFFLEONTOOLTIP;
                    tBALANCE = temp.tBALANCE;
                    tVOLUME = temp.tVOLUME;
                    tGRADIENTCHECK = temp.tGRADIENTCHECK;
                    tBACKGROUNDCOLOR1LABEL = temp.tBACKGROUNDCOLOR1LABEL;
                    tBACKGROUNDCOLOR2LABEL = temp.tBACKGROUNDCOLOR2LABEL;
                    tSELECTCOLORBUTTON = temp.tSELECTCOLORBUTTON;
                    tGROUPBOX = temp.tGROUPBOX;
                    tTABBGCOLORLABEL = temp.tTABBGCOLORLABEL;
                    tSETTINGS = temp.tSETTINGS;
                    tNEWTABheader = temp.tNEWTABheader;
                    tGROUPBOX2 = temp.tGROUPBOX2;
                    tLABELLANGUAGES = temp.tLABELLANGUAGES;
                    tBUTTONLANGUAGES = temp.tBUTTONLANGUAGES;

                }
                catch (Exception ex)
                {
                }
                
               
            }
            else
                System.Windows.Forms.MessageBox.Show("XML file path error!");
        }
        
        
    }
}
